#!/usr/bin/perl
#Author: Ian McCown
#Apache Log Project part 1

$log = $ARGV[0];
%connections = ();

open FILE, "<", $log or die "log not found";
while (<FILE>) {
	$_ =~ / - -/;
	$connections{$`} += 1;
}
close FILE;

$count = 0;
foreach $value ( sort { $connections{$b} <=> $connections{$a} } keys %connections) {
	$count += 1;
	print "$value = $connections{$value}\n";
	if ( $count == 10 ) {
		last;
	}
}

close FILE;